package com.profound.notes.component;

import ohos.agp.components.BaseItemProvider;
import ohos.agp.components.Component;
import ohos.agp.components.LayoutManager;

import java.util.ArrayList;

/**
 * @author zjwujlei
 * @date 2021/5/3
 * @email zjwujlei@sina.com
 * @description
 */

public class SpanLayoutManager{
    public static final int V = 0;
    public static final int H = 1;
    public static final int V_REVERSE = 2;
    public static final int H_REVERSE = 3;

    protected SpanLayout mSpanLayout;
    protected int mWidthSize;
    protected int mWidthMode;
    protected int mHeightSize;
    protected int mHeightMode;
    protected Recycler mRecycler;
    protected BaseItemProvider mProvider;

    Span[] mSpans;
    int mSpanNum;
    //当前只是实现垂直正向布局
    int oritation = V;

    public SpanLayoutManager(int spanNum){
        mSpanNum = spanNum;
    }

    public void setRecycler(Recycler recycler){
        mRecycler = recycler;
    }

    public void setProvider(BaseItemProvider provider){
        mProvider = provider;
    }

    public void setSpanLayout(SpanLayout spanLayout){
        mSpanLayout = spanLayout;
        mWidthSize = mSpanLayout.getEstimatedWidth();
        mHeightSize = mSpanLayout.getEstimatedHeight();
    }

    public void setEstimateSize(int widthEstimatedConfig, int heightEstimatedConfig){
        mWidthSize = Component.EstimateSpec.getSize(widthEstimatedConfig);
        mHeightSize = Component.EstimateSpec.getSize(heightEstimatedConfig);
    }

    public void setOrientation(int orientation) {
    }

    public boolean fill(float left,float top,float right,float bottom,int direction){
        return false;
    }

    static class Span {
        int index;

        int left;
        int top;
        int right;
        int bottom;

        int startLine;
        int endLine;

        @Override
        public String toString() {
            return "Span{" +
                    "index=" + index +
                    ", left=" + left +
                    ", top=" + top +
                    ", right=" + right +
                    ", bottom=" + bottom +
                    ", startLine=" + startLine +
                    ", endLine=" + endLine +
                    '}';
        }
    }

}
